
<template>
  <div id="chooseArea" class="single_page">
    <div class="flowTitle"><a >  选择区位 </a></div>
    <comp-countdown></comp-countdown>
    <div >
          <a v-for="(zone,i) in zoneArr" class="button-zone" @click="showCar(i)">{{zone.text}}<span>(点击进入)</span></a>
    </div>
  </div>
</template>
<style type="text/css" lang="less" >
#chooseArea{
  a.button-zone{
    color: #fff;
    span{
        color: #969494;
        font-size: 1rem;
    }
  }
}
</style>
<script>
import {get,compNav} from '../../public/js/utils.js'
import CompCountdown from '../../components/countdown.vue'
import Swal from 'sweetalert'
export default {
  data: function () {
    this.init()
    return {
      zoneArr:[],
    }
  },
  props:['user'],
  components:{
    CompCountdown
  },
  methods:{
    async init(){
      compNav(this)
      const r =await get('/public/getConfig',{field:'zone'})
      this.zoneArr =JSON.parse(r.value||'[]')
    },
    showCar(index){
      const zone = this.zoneArr[index]
      if(this.user.rem !='ALL'){
        if(this.user.rem.indexOf(','+zone.id+',')<0){
          Swal('','请选择正确区域','error');
          return false;
        }
      }
      this.jump('comp-choosecar',zone)
      // ns_area='zone_'+zoneId;
      // uiHide($('#chooseArea'));
      // if($('#'+ns_area).length){
      //   uiShow($('#'+ns_area)); 
      //   return ;
      // }
      // g_carArea.forEach(function(o){
      //   if(o.id == zoneId){
      //     self.carlocal(o);
      //   }
      // });
    }
  }

}
</script>
